package com.ny.tt;



import java.util.Map;

public class TestMap {
    public void addEmp(Map<String,Emp>map,Emp emp) {
        map.put(emp.getNumber(),emp);
    }

    public void findAllEmp(Map<String,Emp>map) {
        for (Emp emp: map.values()) {
            System.out.println(emp);
        }
    }

    public Emp findEmpName(Map<String,Emp>map,String empName) {
        for (Emp emp: map.values() ) {
            if (empName.equals(emp.getName())) {
                return emp;
            }
        }
        return null;
    }

    public void deleteEmp(Map<String, Emp>map,String empNumber) {
        Emp emp = map.remove(empNumber);
    }

    public Emp findEmpNumber(Map<String,Emp>map, String empNumber) {
        return map.get(empNumber);
    }

    public void updateEmp(Map<String,Emp>map,Emp emp) {
        map.put(emp.getNumber(),emp);
    }
}
